<template>
	<div class="app-container">
		<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="70px"
			class="queryForms">
			<el-form-item label="工序名称" prop="processName">
				<el-input maxlength="20" show-word-limit v-model="queryParams.processName" placeholder="请输入工序名称"
					clearable @keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="返修任务单" prop="repairNumber" label-width="90px">
				<el-input maxlength="20" show-word-limit v-model="queryParams.repairNumber" placeholder="请输入返修任务单号"
					clearable @keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="产品型号" prop="productModel">
				<el-input maxlength="20" show-word-limit v-model="queryParams.productModel" placeholder="请输入产品型号"
					clearable @keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="产品编号" prop="productNumber">
				<el-input maxlength="20" show-word-limit v-model="queryParams.productNumber" placeholder="请输入产品编号"
					clearable @keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="3B号" prop="bNumber">
				<el-input maxlength="20" show-word-limit v-model="queryParams.bNumber" placeholder="请输入3B号" clearable
					@keyup.enter.native="handleQuery" />
			</el-form-item>
			<el-form-item label="工序状态" prop="processStatus">
				<el-select v-model="queryParams.processStatus" placeholder="请选择">
					<el-option label="未完工" value="0"></el-option>
					<el-option label="已完工" value="1"></el-option>
					<el-option label="质检通过" value="2"></el-option>
					<el-option label="质检不通过" value="3"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
				<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
			</el-form-item>
		</el-form>
		<el-row :gutter="10" class="mb8">
			<el-col :span="1.5">
				<el-button type="primary" size="mini" :disabled="multiple" @click="handleUpdates"
					v-hasPermi="['erp:quality:edit']">质检</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button size="mini" type="info" @click="handleBacks">返回</el-button>
			</el-col>
			<el-col :span="1.5">
				<el-button size="mini">{{ $route.query.productName }}-{{ $route.query.productModel }} (产品编号：{{
					$route.query.productNumber }})</el-button>
			</el-col>
			<CreateForm :ids="ids" formtype="t_quality_quality_menu" />
			<right-toolbar menuNames="qualityInspection45" @changeTableData="changeTableData"
				:showSearch.sync="showSearch" @queryTable="getList" :columns.sync="columns"
				perm="erp:quality:list"></right-toolbar>
		</el-row>

		<div :class="eleTabTop <= 85 ? 'eleTab' : ''" class="informationTab" ref="eleTab">
			<el-table ref="table" @row-click="row_click" v-loading="loading" :data="repairProductProcessList"
				@selection-change="handleSelectionChange" border height="100%">
				<el-table-column type="selection" width="55" align="center" />
				<el-table-column label="序号" align="center" type="index" width="55" />
				<el-table-column label="返修任务单" prop="repairNumber" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[0].visible" />
				<!-- <el-table-column label="工序编码" prop="processCode" min-width="150" :show-overflow-tooltip="true" v-if="columns[1].visible" /> -->
				<el-table-column label="工序名称" prop="processName" min-width="150" v-if="columns[2].visible">
					<template slot-scope="scope">
						<el-tooltip placement="left">
							<div slot="content" class="custom-tooltip-content">
								<div id="editorVal" v-html="scope.row.content"></div>
							</div>
							<div class="custom-tooltip-trigger">{{ scope.row.processName }}</div>
						</el-tooltip>
					</template>
				</el-table-column>
				<el-table-column label="工序状态" align="center" prop="processStatus" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[18].visible">
					<template slot-scope="scope">
						<el-tag type="info" v-if="scope.row.processStatus == '0'">未完工</el-tag>
						<el-tag type="warning" v-if="scope.row.processStatus == '1'">已完工</el-tag>
						<el-tag type="success" v-if="scope.row.processStatus == '2'">质检通过</el-tag>
						<el-tag type="danger" v-if="scope.row.processStatus == '3'">质检不通过</el-tag>
					</template>
				</el-table-column>
				<el-table-column label="产品名称" prop="productName" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[3].visible" />
				<el-table-column label="产品型号" prop="productModel" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[4].visible" />
				<el-table-column label="产品编号" prop="productNumber" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[5].visible" />
				<el-table-column label="填写时间" prop="accomplishTime" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[19].visible" />
				<el-table-column label="客户名称" prop="clientName" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[6].visible" />
				<el-table-column label="客户代表" prop="productRepresentativeName" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[7].visible" />
				<el-table-column label="3B号" prop="bNumber" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[8].visible" />
				<el-table-column label="计划开始时间" prop="programBeginTime" min-width="180" :show-overflow-tooltip="true"
					v-if="columns[9].visible" />
				<el-table-column label="计划完成时间" prop="programFinishTime" min-width="180" :show-overflow-tooltip="true"
					v-if="columns[10].visible" />
				<el-table-column label="维修类别" prop="maintenanceCategoryName" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[11].visible" />
				<el-table-column label="故障原因" prop="failureCause" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[12].visible" />
				<el-table-column label="故障模式" prop="failureMode" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[13].visible" />
				<el-table-column label="故障核实情况" align="center" prop="malfunctionStatus" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[14].visible">
					<template slot-scope="scope">
						<div v-if="scope.row.malfunctionStatus == '0'">无故</div>
						<div v-if="scope.row.malfunctionStatus == '1'">有故</div>
						<div v-if="scope.row.malfunctionStatus == '2'">待核实</div>
					</template>
				</el-table-column>
				<el-table-column label="工艺通知单编号" prop="processNumber" min-width="150" :show-overflow-tooltip="true"
					v-if="columns[15].visible" />
				<el-table-column label="工艺流名称" prop="productTechnologyName" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[16].visible" />
				<el-table-column label="工时" align="center" prop="processTime" min-width="150"
					:show-overflow-tooltip="true" v-if="columns[17].visible" />

				<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right"
					width="320">
					<template slot-scope="scope">
						<el-button v-if="scope.row.processStatus == '1'" size="mini" type="text" icon="el-icon-edit"
							@click="handleUpdate(scope.row)" v-hasPermi="['erp:quality:edit']">质检</el-button>

						<el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdits(scope.row)"
							v-hasPermi="['erp:quality:edits']">修改</el-button>
						<el-button size="mini" type="text" icon="el-icon-wallet" @click="handleFiles(scope.row)"
							v-hasPermi="['erp:quality:files']">附件</el-button>
						<el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)"
							v-hasPermi="['erp:quality:details']">详情</el-button>
						<el-button size="mini" type="text" icon="el-icon-view" @click="handleworkDetail(scope.row)"
							v-hasPermi="['erp:quality:workdetails']">工作单详情</el-button>
					</template>
				</el-table-column>
			</el-table>
		</div>

		<pagination menuNames="Pagination48" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
			:limit.sync="queryParams.pageSize" @pagination="getList" />

		<!-- 添加或修改返修单产品工序列对话框 -->
		<el-dialog :title="titleData" :visible.sync="open" width="900px" append-to-body v-dialogDrag>
			<el-form ref="form" :model="form" :rules="rules" label-width="90px">
				<div v-if="disableds">
					<el-row :gutter="20">
						<el-col :span="12">
							<el-form-item label="工艺流名称" prop="productTechnologyName">
								<el-input v-model="form.productTechnologyName" placeholder="请输入工艺流名称" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="工序编码" prop="processCode">
								<el-input v-model="form.processCode" placeholder="请输入工序编码" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="工序名称" prop="processName">
								<el-input v-model="form.processName" placeholder="请输入工序名称" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="工时" prop="processTime">
								<el-input v-model="form.processTime" placeholder="请输入工时" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="完成人名称" prop="accomplishUserName">
								<el-input v-model="form.accomplishUserName" placeholder="请输入完成人名称" disabled />
							</el-form-item>
						</el-col>
						<el-col :span="24">
							<el-form-item label="质检意见" prop="qualityTestOpinion">
								<el-input v-model="form.qualityTestOpinion" placeholder="请输入质检意见" disabled
									type="textarea" :rows="3" />
							</el-form-item>
						</el-col>
					</el-row>
				</div>
				<div v-else>
					<el-row>
						<el-col :span="12">
							<el-form-item label="质检时间" prop="qualityTestTime">
								<el-date-picker v-model="form.qualityTestTime" type="date" placeholder="选择日期"
									value-format="yyyy-MM-dd" format="yyyy-MM-dd"> </el-date-picker>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="24">
							<el-form-item label="质检意见" prop="qualityTestOpinion">
								<el-input v-model="form.qualityTestOpinion" placeholder="请输入质检意见" type="textarea"
									:rows="3" />
							</el-form-item>
						</el-col>
					</el-row>
				</div>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitFormEdit">确 认</el-button>
				<el-button @click="cancelEdit">取 消</el-button>
			</div>
		</el-dialog>

		<el-dialog title="质检" :visible.sync="openQuality" width="900px" append-to-body v-dialogDrag>
			<el-form ref="forms" :model="forms" label-width="80px">
				<el-form-item label="质检意见" prop="qualityTestOpinion">
					<el-input v-model="forms.qualityTestOpinion" placeholder="请输入质检意见" type="textarea" maxlength="100"
						show-word-limit />
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm">合 格</el-button>
				<el-button @click="cancel">不 合 格</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
import { fillIns, fillIn, listRepairProductProcess1, getRepairProductProcess, delRepairProductProcess, addRepairProductProcess, updateRepairProductProcess } from "@/api/taskFilling/repairProductProcess"
import CreateForm from "@/views/components/CreateForm"
import { getcolumn } from "@/api/selectList"
export default {
	name: "qualityInspection", 
	components: { CreateForm },
	data() {
		return {
			titleData: "",
			disableds: false,
			columnWidths: {}, // 用于存储列宽
			contentHtml: "",
			eleTabTop: 0, //表格容器距浏览器顶部距离
			forms: {},
			openQuality: false,
			// 遮罩层
			loading: true,
			// 选中数组
			ids: [],
			// 非单个禁用
			single: true,
			// 非多个禁用
			multiple: true,
			// 显示搜索条件
			showSearch: true,
			// 总条数
			total: 0,
			// 返修单产品工序列表格数据
			repairProductProcessList: [],
			// 弹出层标题
			title: "",
			// 是否显示弹出层
			open: false,
			// 查询参数
			queryParams: {
				pageNum: 1,
				pageSize: 10,
				militaryStatus: 0,
				repairProductId: null,
				productProcessId: null,
				productTechnologyId: null,
				productTechnologyName: null,
				processName: null,
				processTime: null,
				content: null,
				processStatus: null,
				accomplishUserId: null,
				accomplishUserName: null,
				repairNumber: null,
				productModel: null,
				productNumber: null,
				bNumber: null
			},
			// 表单参数
			form: {},
			QualityId: "",
			// 表单校验
			rules: {
				delFlag: [{ required: true, message: "删除标志不能为空", trigger: "blur" }]
			},
			singleIds: true,
			// 列信息
			columns: [
				{ key: 0, label: `返修任务单`, visible: true, width: 300, prop: "repairNumber" },
				{ key: 1, label: `工序编码`, visible: true, width: 150 },
				{ key: 2, label: `工序名称`, visible: true, width: 150, prop: "processName" },
				{ key: 3, label: `产品名称`, visible: true, width: 150 },
				{ key: 4, label: `产品型号`, visible: true, width: 150 },
				{ key: 5, label: `产品编号`, visible: true, width: 150 },
				{ key: 6, label: `客户名称`, visible: true, width: 150 },
				{ key: 7, label: `客户代表`, visible: true, width: 150 },
				{ key: 8, label: `3B号`, visible: true, width: 150 },
				{ key: 9, label: `计划开始时间`, visible: true, width: 150 },
				{ key: 10, label: `计划完成时间`, visible: true, width: 150 },
				{ key: 11, label: `维修类别`, visible: true, width: 150 },
				{ key: 12, label: `故障原因`, visible: true, width: 150 },
				{ key: 13, label: `故障模式`, visible: true, width: 150 },
				{ key: 14, label: `故障核实情况`, visible: true, width: 150 },
				{ key: 15, label: `工艺通知单编号`, visible: true, width: 150 },
				{ key: 16, label: `工艺流名称`, visible: true, width: 150 },
				{ key: 17, label: `工时`, visible: true, width: 150 },
				{ key: 18, label: `工序状态`, visible: true, width: 150 },
				{ key: 19, label: `填写时间`, visible: true, width: 150 },
			],
			originalArray: [],
      repairProductId:''
		}
	},
	created() {
    	// this.repairProductId = this.$route.query.id
		// this.getSize()
	},
	mounted() {
		// 从localStorage恢复列宽
		//    const savedColumnWidths = JSON.parse(localStorage.getItem('columnWidths')) || [];
		// if (savedColumnWidths.length) {
		//   // 确保列的顺序与原始columns数组一致
		//   this.columns = savedColumnWidths.map(savedCol => {
		//     const originalCol = this.columns.find(col => col.prop === savedCol.prop);
		//     if (originalCol) {
		//       return { ...originalCol, width: savedCol.width };
		//     }
		//     return savedCol;
		//   });
		// }
		// console.log(this.columns)
		// 滚动条的获取
		this.handleScrollx()
		window.addEventListener("scroll", this.handleScrollx, true)
	},
	activated() {
		this.repairProductId = this.$route.query.id
		this.getSize()
		//获取表格容器距页面头部的距离
		this.handleScrollx()
	},
	destroyed() {
		window.removeEventListener("scroll", this.handleScrollx, true)
	},
	methods: {
		handleHeaderDragend1(newWidth, oldWidth, column) {
			// 保存调整后的列宽到 localStorage
			this.columnWidths[column.property] = newWidth
			// this.columnWidths.name = column.property
			// this.columnWidths.width = newWidth
			// this.originalArray.push(this.columnWidths)
			// // 新数组，用于存储结果
			// const newArray = []
			// console.log(this.originalArray,'this.originalArray')
			// // 使用 forEach 循环遍历原始数组
			// this.originalArray.forEach(obj => {
			// 	// 检查对象是否有 name 属性，并且值是否与 targetName 相同
			// 	if (obj.name === column.property) {
			// 		// 查找新数组中是否已经存在相同 name 的对象
			// 		const existingObjIndex = newArray.findIndex(item => item.name === column.property)
			// 		if (existingObjIndex !== -1) {
			// 			// 如果存在，则覆盖该对象
			// 			newArray[existingObjIndex] = obj
			// 		} else {
			// 			// 如果不存在，则添加到新数组中
			// 			newArray.push(obj)
			// 		}
			// 	}
			// })
			// console.log(newArray);
			//
			localStorage.setItem("columnWidths", JSON.stringify(this.columnWidths))
		},

		handleHeaderDragend(newWidth, oldWidth, column) {
			// 找到列的索引
			const index = this.columns.findIndex(col => col.prop === column.prop)
			if (index !== -1) {
				// 使用 Vue.set 更新列宽信息
				this.$set(this.columns[index], "width", newWidth)
				// 保存到localStorage
				localStorage.setItem("columnWidths", JSON.stringify(this.columns))
			}
		},
		getSize() {
			// this.$nextTick(() => {
			// 	// 从 localStorage 恢复列宽
			// 	const savedColumnWidths = JSON.parse(localStorage.getItem("columnWidths")) || {}
			// 	console.log(savedColumnWidths)
			// 	// 使用 Object.entries() 将对象转换为数组
			// 	const resultArray = Object.entries(savedColumnWidths).map(([key, value]) => {
			// 		return { name: key, width: value }
			// 	})

			// 	resultArray.forEach(item => {
			// 		this.columns.forEach(column => {
			// 			if (column.prop == item.name) {
			// 				column.width = item.width
			// 			}
			// 		})
			// 	})
			// })

			// console.log(this.columns)
			// this.$forceUpdate()
			getcolumn({ pageName: "Pagination48" }).then(response => {
				this.queryParams.pageSize = response.data.length ? (response.data[0].limit ? response.data[0].limit : 10) : 10
				this.getList()
			})
		},
		// 单击表格行
		row_click(row, column, event) {
			if (column && column.label == "操作") {
				return
			} else {
				this.$refs.table.toggleRowSelection(row)
			}
		},
		changeTableData() {
			this.$nextTick(() => {
				this.$refs.table.doLayout()
			})
		},

		handleBacks() {
			// 关闭当前tab页签，打开新页签
			const obj = { path: "/quality/quality_menu" }
			this.$tab.closePage(obj).then(() => {
				if (this.$route.query.paths) {
					console.log("99")
					this.$router.push({
						path: this.$route.query.paths,
						query: {
							queryData: this.$route.query.queryParams
						}
					})
				} else {
					this.$router.go(-1)
				}
			})
		},
		handleworkDetail(row) {
			// console.log(this.$route.query.productName)
			// let querys = {
			// 	id: row.id,
			// 	status: 3,
			// 	repairProductId: row.repairProductId,
			// 	workshopSectionId: row.workshopSectionId,
			// 	technologyDictCode: row.technologyDictCode,
			// 	processType: row.processType,
			// 	isWrite: 2,
			// 	processStatus: row.processStatus,
			// 	productName: this.$route.query.productName,
			// 	productModel: this.$route.query.productModel,
			// 	productNumber: this.$route.query.productNumber
			// }
			// localStorage.setItem("WriteKey", JSON.stringify(querys))
			this.$router.push({
				path: "/taskFilling/taskFill/writeContent/index",
				query: {
					id: row.id,
					status: 3,
					repairProductId: row.repairProductId,
					workshopSectionId: row.workshopSectionId,
					technologyDictCode: row.technologyDictCode,
					processType: row.processType,
					isWrite: 2,
					processStatus: row.processStatus,
					productName: this.$route.query.productName,
					productModel: this.$route.query.productModel,
					productNumber: this.$route.query.productNumber
				}
			})
		},
		//获取表格容器距页面头部的距离
		handleScrollx() {
			this.eleTabTop = this.$refs.eleTab.getBoundingClientRect().top
		},
		getFormdata(row) {
			getRepairProductProcess(row.id).then(res => {
				this.form = res.data
				this.open = true
			})
		},
		handleDetail(row) {
			this.titleData = "详情"
			this.disableds = true
			this.getFormdata(row)
		},
		handleEdits(row) {
			this.titleData = "修改"
			this.disableds = false
			this.getFormdata(row)
		},
		handleFiles(row) {
			this.$router.push({
				path: "/attachment/attachmentUpload",
				query: {
					TableId: row.id,
					typeId: 15,
					perm: "erp:quality:files"
				}
			})
		},
		/** 查询返修单产品工序列列表 */
		getList() {
			this.loading = true
			this.queryParams.repairProductId = this.repairProductId
			listRepairProductProcess1(this.queryParams).then(response => {
				response.rows.forEach(element => {
					const parser = new DOMParser()
					const pastedDoc = parser.parseFromString(element.content, "text/html")
					const inputs = pastedDoc.querySelectorAll("input")
					inputs.forEach(item => {
						if ((item.type == "text" && item.value == "true") || (item.type == "text" && item.value == "false")) {
							item.style.setProperty("color", "white")
							var serializer = new XMLSerializer()
							// 将文档对象转换为HTML字符串
							var htmlString = serializer.serializeToString(pastedDoc)
							var doc1 = parser.parseFromString(htmlString, "text/html")
							var ols1 = doc1.querySelectorAll("body")
							// 获取body元素内的HTML内容
							var bodyContent = ols1[0].innerHTML
							element.content = bodyContent
						}
					})
				})
				this.repairProductProcessList = response.rows
				this.total = response.total
				this.loading = false
			})
		},
		// 取消按钮
		cancel() {
			if (this.singleIds) {
				this.setStatus("6")
			} else {
				this.setStatusData("6")
			}
		},
		submitFormEdit() {
			this.form.submitStatus = 1
			fillIn(this.form).then(res => {
				this.$modal.msgSuccess("修改成功")
				this.open = false
				this.getList()
			})
		},
		cancelEdit() {
			this.open = false
		},
		submitForm() {
			if (this.singleIds) {
				this.setStatus("5")
			} else {
				this.setStatusData("5")
			}
		},
		setStatusData(ststus) {
			const loading = this.$loading({
				lock: true,
				text: "Loading",
				spinner: "el-icon-loading",
				background: "rgba(0, 0, 0, 0.7)"
			})
			fillIns({
				ids: this.ids,
				submitStatus: ststus,
				qualityTestOpinion: this.forms.qualityTestOpinion
			})
				.then(res => {
					this.$modal.msgSuccess("设置成功")
					localStorage.setItem("todoMessage", "qualityInspection1")
					this.openQuality = false
					loading.close()
					this.getList()
				})
				.finally(() => {
					loading.close()
				})
		},
		setStatus(ststus) {
			const loading = this.$loading({
				lock: true,
				text: "Loading",
				spinner: "el-icon-loading",
				background: "rgba(0, 0, 0, 0.7)"
			})
			fillIn({
				id: this.QualityId,
				submitStatus: ststus,
				qualityTestOpinion: this.forms.qualityTestOpinion
			})
				.then(res => {
					this.$modal.msgSuccess("设置成功")
					localStorage.setItem("todoMessage", "qualityInspection2")
					loading.close()
					this.openQuality = false
					this.getList()
				})
				.finally(() => {
					loading.close()
				})
		},
		// 表单重置
		reset() {
			this.form = {
				id: null,
				repairProductId: null,
				productProcessId: null,
				productTechnologyId: null,
				productTechnologyName: null,
				processCode: null,
				processName: null,
				processTime: null,
				content: null,
				processStatus: null,
				accomplishUserId: null,
				accomplishUserName: null,
				remark: null,
				repairNumber: null,
				updateTime: null
			}
			this.resetForm("form")
		},
		/** 搜索按钮操作 */
		handleQuery() {
			this.queryParams.pageNum = 1
			this.getList()
		},
		/** 重置按钮操作 */
		resetQuery() {
			this.resetForm("queryForm")
			this.handleQuery()
		},
		// 多选框选中数据
		handleSelectionChange(selection) {
			this.ids = selection.map(item => item.id)
			this.single = selection.length !== 1
			this.multiple = !selection.length
		},
		/** 新增按钮操作 */
		handleAdd() {
			this.reset()
			this.open = true
			this.title = "添加返修单产品工序列"
		},
		/** 修改按钮操作 */
		handleUpdate(row) {
			this.singleIds = true
			this.resetquality()
			// 质检
			this.openQuality = true
			this.QualityId = row.id
		},
		/** 修改按钮操作 */
		handleUpdates() {
			this.singleIds = false
			this.resetquality()
			// 质检
			this.openQuality = true
		},
		resetquality() {
			this.forms = {
				qualityTestOpinion: undefined
			}
		},
		/** 删除按钮操作 */
		handleDelete(row) {
			const ids = row.id || this.ids
			this.$modal
				.confirm("是否确认删除返修单产品工序数据项？")
				.then(function () {
					return delRepairProductProcess(ids)
				})
				.then(() => {
					this.getList()
					this.$modal.msgSuccess("删除成功")
				})
				.catch(() => { })
		},
		/** 导出按钮操作 */
		handleExport() {
			this.download(
				"erp/repairProductProcess/export",
				{
					...this.queryParams
				},
				`repairProductProcess_${new Date().getTime()}.xlsx`
			)
		}
	}
}
</script>

<style lang="scss" scoped>
.custom-tooltip-content {
	color: #606266;
	background-color: #fff;
	padding: 1px;
	width: 760px;
	border-radius: 2px;
}

#editorVal {
	width: 760px !important;
	max-height: 500px !important;
	overflow-y: auto;
	font-size: 14px;

	::v-deep input[type="text"] {
		border: none;
		outline: none;
		border-bottom: 1px solid #666;
	}
}
</style>
